package com.mvkcloud.open.context;

public class TenantContext {

    private static ThreadLocal<TenantContext> KEEP = new ThreadLocal();
    private String appId;
    private String appKey;

    public TenantContext() {
    }

    public static TenantContext init(String appId, String appKey) {
        TenantContext ctx = new TenantContext();
        ctx.setAppId(appId);
        ctx.setAppKey(appKey);
        KEEP.set(ctx);
        return ctx;
    }


    public TenantContext get() {
        return (TenantContext)KEEP.get();
    }

    public static void destroy() {
        KEEP.remove();
    }

    public String getAppId() {
        return this.appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppKey() {
        return this.appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }
}
